package cn.iocoder.yudao.module.written.exam.controller.admin.member;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.written.exam.controller.admin.member.vo.WrittenExamMemberPageReqVO;
import cn.iocoder.yudao.module.written.exam.controller.admin.member.vo.WrittenExamMemberRespVO;
import cn.iocoder.yudao.module.written.exam.service.userwrittenexamrecords.UserWrittenExamRecordsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - 笔试会员")
@RestController
@RequestMapping("/written-exam/member")
@Validated
public class WrittenExamMemberController {

    @Resource
    private UserWrittenExamRecordsService userWrittenExamRecordsService;

    @PostMapping("/page")
    @Operation(summary = "获得笔试会员分页")
    @PreAuthorize("@ss.hasPermission('written-exam:member:query')")
    public CommonResult<PageResult<WrittenExamMemberRespVO>> getWrittenExamMemberPage(@Valid @RequestBody WrittenExamMemberPageReqVO pageReqVO) {
        return success(userWrittenExamRecordsService.getWrittenExamMemberPage(pageReqVO));
    }

}